﻿using System;
using System.IO.IsolatedStorage;
using System.IO;

class VirtualAssembyFile
{
    static void Main()
    {
        IsolatedStorageFile virtualSpace = IsolatedStorageFile.GetUserStoreForAssembly();
        using (virtualSpace)
        {
            IsolatedStorageFileStream stream = new IsolatedStorageFileStream("example.txt", FileMode.OpenOrCreate, virtualSpace);
            using (stream)
            {
                StreamReader reader = new StreamReader(stream);
                Console.WriteLine(reader.ReadToEnd());
                //stream.SetLength(0); //Overwrite the file
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    Console.WriteLine("Say:");
                    writer.WriteLine(DateTime.Now+": {0}",Console.ReadLine());
                }
            }
        }

        //IsolatedStorageFile.Remove(IsolatedStorageScope.User); to delete the virtual spaces
    }
}

